import { Injectable } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'

@Injectable()
export class ConfigurationService {
  constructor(private configService: ConfigService) {}

  get mysqlHost() {
    return this.configService.get<string>('MYSQL_HOST')
  }
  get mysqlPort() {
    return this.configService.get<number>('MYSQL_PORT')
  }
  get mysqlDb() {
    return this.configService.get<string>('MYSQL_DB')
  }
  get mysqlUser() {
    return this.configService.get<string>('MYSQL_USER')
  }
  get mysqlPassword() {
    return this.configService.get<string>('MYSQL_PASSWORD')
  }
  get mysqlConfig() {
    return {
      host: this.mysqlHost,
      port: this.mysqlPort,
      database: this.mysqlDb,
      username: this.mysqlUser,
      password: this.mysqlPassword,
    }
  }
}